home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-03-31 | 38.7 KB | 1,139 lines | [TEXT/R*ch] |
- C.S.M.P. Digest Thu, 28 Mar 96 Volume 3 : Issue 142
-
- Today's Topics:
-
- "volatile" variables?
- A Good Random-number Generator (here it is!)
- Apple Event handlers & C++
- CodeWarrior - faster code than MrC?
- Desktop pattern for a window
- Direct-to-screen drawing and Copland
- Shareware Modula-2 compiler for Mac
- Sharing Name
- Writing a scriptable app
- [Q] How to write a FAT inline LDEF
- [Q] Where is the NBP queue located on an Open Transport-based Mac?
- gworlds 7.5.3
-
-
-
- The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
- (pottier@clipper.ens.fr).
-
- The digest is a collection of article threads from the internet
- newsgroups comp.sys.mac.programmer.help, csmp.tools, csmp.misc and
- csmp.games. It is designed for people who read news semi-regularly and
- want an archive of the discussions. If you don't know what a
- newsgroup is, you probably don't have access to it. Ask your systems
- administrator(s) for details. If you don't have access to news, you
- may still be able to post messages to the group by using a mail server
- like anon.penet.fi (mail help@anon.penet.fi for more information).
-
- Each issue of the digest contains one or more sets of articles (called
- threads), with each set corresponding to a 'discussion' of a particular
- subject. The articles are not edited; all articles included in this digest
- are in their original posted form (as received by our news server at
- nef.ens.fr). Article threads are not added to the digest until the last
- article added to the thread is at least two weeks old (this is to ensure that
- the thread is dead before adding it to the digest). Article threads that
- consist of only one message are generally not included in the digest.
-
- The digest is officially distributed by two means, by email and ftp.
-
- If you want to receive the digest by mail, send email to listserv@ens.fr
- with no subject and one of the following commands as body:
- help Sends you a summary of commands
- subscribe csmp-digest Your Name Adds you to the mailing list
- signoff csmp-digest Removes you from the list
- Once you have subscribed, you will automatically receive each new
- issue as it is created.
-
- The official ftp info is ftp://ftp.dartmouth.edu/pub/csmp-digest.
- Questions related to the ftp site should be directed to
- scott.silver@dartmouth.edu.
-
- -------------------------------------------------------
-
- >From jim@bogie2.bio.purdue.edu (Jim Cavera)
- Subject: "volatile" variables?
- Date: Wed, 06 Mar 1996 12:40:51 -0500
- Organization: Purdue University
-
- In some example code on the CW reference CD, I see some variables
- with a modifier of "volatile". In example :
-
- volatile short result = 0;
-
- Could someone give me a simplistic explanation of (a) what this
- means and (b) why someone would want to do it? Thanks in
- advance.
-
- - Jim Cavera (bit-pushing slave)
- jim@bogie2.bio.purdue.edu
-
- +++++++++++++++++++++++++++
-
- >From rickgenter@aol.com (RickGenter)
- Date: 6 Mar 1996 15:05:03 -0500
- Organization: America Online, Inc. (1-800-827-6364)
-
- In article <jim-0603961240510001@ibcrc3.bio.purdue.edu>,
- jim@bogie2.bio.purdue.edu (Jim Cavera) writes:
-
- >In some example code on the CW reference CD, I see some variables
- >with a modifier of "volatile". In example :
- >
- >volatile short result = 0;
- >
- >Could someone give me a simplistic explanation of (a) what this
- >means and (b) why someone would want to do it? Thanks in
- >advance.
-
- A volatile variable is one whose value may change outside the scope of the
- program. Two examples are:
-
- - memory mapped I/O registers - reading the same location twice in a row
- may result in different values
- - global variables shared by several threads/processes, or accessed by an
- interrupt handler. For example, the ioResult parameter of any parameter
- block should be declared volatile, because it can be changed "out from
- underneath the program."
-
- The volatile declaration is used to prevent the compiler from optimizing
- access to the variable by loading it into a register and keeping it there.
- A volatile variable must be loaded from memory on each access.
-
- Rick Genter
- Papyrus Design Group, Inc.
-
- +++++++++++++++++++++++++++
-
- >From "Andrew C. Plotkin" <erkyrath+@CMU.EDU>
- Date: Wed, 6 Mar 1996 14:44:00 -0500
- Organization: Carnegie Mellon, Pittsburgh, PA
-
- jim@bogie2.bio.purdue.edu (Jim Cavera) writes:
- > In some example code on the CW reference CD, I see some variables
- > with a modifier of "volatile". In example :
- >
- > volatile short result = 0;
- >
- > Could someone give me a simplistic explanation of (a) what this
- > means and (b) why someone would want to do it? Thanks in
- > advance.
-
- volatile means that the variable can change without the program
- changing it. For example, a memory-mapped IO location can be changed
- at arbitrary times by the IO hardware. The compiler has to know this,
- because otherwise it might optimize away important reads. For example,
-
- while (io_loc) {
- counter++;
- };
-
- might be optimized to only read io_loc once, since it looks like
- io_loc never changes during the loop. If you declare io_loc to be
- volatile, the compiler knows not to do that.
-
- Why would someone want to do it? It's important in writing
- interrupt-driven code, like device drivers. I've never had a use for
- it. (Even when writing interrupt-time code like sound manager
- callbacks.)
-
- --Z
-
- "And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."
-
- +++++++++++++++++++++++++++
-
- >From Tom Smith <tom_smith@moldev.com>
- Date: Wed, 06 Mar 1996 16:20:00 -0800
- Organization: Molecular Devices
-
- Andrew C. Plotkin wrote:
- >
- > jim@bogie2.bio.purdue.edu (Jim Cavera) writes:
- > > In some example code on the CW reference CD, I see some variables
- > > with a modifier of "volatile". In example :
- > >
- > > volatile short result = 0;
- > >
- > > Could someone give me a simplistic explanation of (a) what this
- > > means and (b) why someone would want to do it? Thanks in
- > > advance.
- >
- > volatile means that the variable can change without the program
- > changing it. For example, a memory-mapped IO location can be changed
- > at arbitrary times by the IO hardware. The compiler has to know this,
- > because otherwise it might optimize away important reads. For example,
- >
- > while (io_loc) {
- > counter++;
- > };
- >
- > might be optimized to only read io_loc once, since it looks like
- > io_loc never changes during the loop. If you declare io_loc to be
- > volatile, the compiler knows not to do that.
- >
- > Why would someone want to do it? It's important in writing
- > interrupt-driven code, like device drivers. I've never had a use for
- > it. (Even when writing interrupt-time code like sound manager
- > callbacks.)
- >
-
- I once needed it when writing a memory test. The code would write out
- to a memory location and then expect to read back the same thing. The
- first pass worked so well, it found memory where there wasn't any. The
- compiler would write the location, but didn't bother to ever read it
- back in because it "knew" what was there.
-
- +++++++++++++++++++++++++++
-
- >From jonpugh@netcom.com (Jon Pugh)
- Date: Sun, 10 Mar 1996 20:54:10 GMT
- Organization: Apple Computer
-
- In article <jim-0603961240510001@ibcrc3.bio.purdue.edu>,
- jim@bogie2.bio.purdue.edu (Jim Cavera) wrote:
-
- >In some example code on the CW reference CD, I see some variables
- >with a modifier of "volatile". In example :
- >
- >volatile short result = 0;
- >
- >Could someone give me a simplistic explanation of (a) what this
- >means and (b) why someone would want to do it? Thanks in
- >advance.
-
- You've heard what it does, but the other reason to do it is because of
- setjmp & longjmp which some people are still using in their exception
- macros. If you have a variable or object which is referenced by a pointer
- before a call to setjmp and then the register state is restored by a call
- to longjmp, then you could have an old value in the register if you don't
- use the volatile keyword.
-
- Jon
-
- --
- What are YOU doing to oppose the Microsoft juggernaut?
- http://www.infoworkshop.com/~jonpugh/
-
- +++++++++++++++++++++++++++
-
- >From dbrosius@chesco.com (Dave M Brosius)
- Date: 10 Mar 1996 08:45:56 GMT
- Organization: Chester County Internet Services, Inc.
-
- In article <jim-0603961240510001@ibcrc3.bio.purdue.edu>,
- jim@bogie2.bio.purdue.edu (Jim Cavera) wrote:
-
- > In some example code on the CW reference CD, I see some variables
- > with a modifier of "volatile". In example :
- >
- > volatile short result = 0;
- >
- > Could someone give me a simplistic explanation of (a) what this
- > means and (b) why someone would want to do it? Thanks in
- > advance.
- >
- > - Jim Cavera (bit-pushing slave)
- > jim@bogie2.bio.purdue.edu
-
- If a variable is going to change values outside of the normal code logic,
- you must declare it volatile, so that the compiler knows to check it each
- time.
-
- consider an asynchronous write
-
- rPB.ioParam.ioCompletion = NULL;
- rPB.ioParam.ioReqCount = 10240;
- rPB.ioParam.ioBuffer = &myData;
- rPB.ioParam.ioPosMode = fsFromMark;
- rPB.ioParam.ioPosOffset = 0;
-
- iErr = PBWrite( &rPB, true ); // <- look asynchronous
-
- while (rPB.ioParam.ioResult == 1)
- {
- SpinCursor( );
- DroolDownChin( );
- }
-
-
- Notice that in the while loop, there's nothing that's going to
- change rPB.ioParam.ioResult. It happens asynchronously. The compiler may
- say to itself, I can optimize this by copying rPB.ioParam.ioResult into a
- register before the while loop, and just checking the register each time
- through the loop. A really optimizing compiler wouldn't even check it at all
- (after the first time).
-
- By saying volatile, your telling the compiler, that, even though it seems
- silly, check the actual variable every stinkin' time through the loop.
-
- HTH
-
- --
- Please reply via email as well
- dave dbrosius@chesco.com
-
- ---------------------------
-
- >From "Michael P. McLaughlin" <mpmcl@mitre.org>
- Subject: A Good Random-number Generator (here it is!)
- Date: Mon, 11 Mar 1996 13:48:13 -0509
- Organization: The MITRE Corporation
-
- I've seen many requests here and elsewhere for random-number code for the Mac. Usually, the
- requests are for something that is very good (i.e., random) or really fast or with a very long
- period.
-
- In our group, we are heavy users of such generators (billions of random-number calls per week)
- because we do a *lot* of Monte Carlo simulation (100 percent Macintosh). Since I've been the
- recipient of much good (free) advice from newsgroups like this one, I thought I'd offer partial
- repayment, in kind, by placing this random-number library in the public domain. It is very random
- AND very fast AND has a very long period. In fact, modesty aside, I doubt that there is a better
- one publically available anywhere.
-
- The easiest way to find it is to go to Web site
-
- http://hyperarchive.lcs.mit.edu/HyperArchive.html
-
- and search for
-
- RandomNumberLib
-
- The body of the README file is reproduced below:
-
- UltraLibU -- A pseudo-random-number library for Macintosh platforms
-
- This library is a new C/Assembly implementation of the Ultra PRNG developed by Marsaglia, et al.
- (see leading reference in source). It is designed primarily for Macintosh platforms and replaces
- an earlier (non-PPC) library, by this author, that is currently available in a number of public
- archives.
-
- UltraLibU contains one low-level assembly routine, in a conditional-compilation block, for MC68020
- (and higher) or PowerPC processors. (Note: Pure C source for this routine is already available in
- the usual Internet archives.) The assembly syntax is that of Metrowerks' CodeWarrior<TM> but
- adaptation to other compilers should be trivial.
-
- Requirements:
-
- Either an MC68020 (or higher) processor or a PowerPC processor.
- A C compiler with an assembler for the processor used.
-
- Public functions:
-
- 7 functions returning various forms of uniform long/short variates
- 1 function returning Boolean variates
- 2 functions returning (float) U(0,1) and (float) U(-1,1) variates
- 2 functions returning (double) U(0,1) and (double) U(-1,1) variates
- 1 function returning (float) Normal(mu,sigma) variates [exact, not approximate]
- 1 function returning (float) Exponential(mu) variates [exact, not approximate]
-
- 1 function to initialize the library
- 2 functions to save and restore the status of the PRNG [to reproduce a sequence exactly]
-
- Special features:
-
- Variates are HIGHLY RANDOM. This PRNG uses a compound generator and produces numbers that are
- random even at the bit level. Moreover, all the bits in each variate are random, not just the most
- sigificant bits.
-
- Execution is VERY FAST, e.g.,
- Booleans --> 0.65 and 0.23 microseconds each on a Quadra 800 and PowerMac 9500/120, resp.
- Normals --> 24.0 and 2.74 microseconds each on a Quadra 800 and PowerMac 9500/120, resp.
- [complete timing list in source]
-
- The (float) U(0,1) and (float) U(-1,1) variates are automatically scaled. Their mantissas always
- have at least 25 bits of precision no matter how small the return values. Neither returns zero.
-
- The period of this compound generator exceeds 10^356.
-
- - ------------------------------------------------------------------------------------------------
-
- This package contains the following files:
-
- (this file)
- UltraLibU.c (the library)
- UltraU.h (an essential header file)
- UltraUTest.c (a demonstration/test program)
- UltraUTest.out.org (the expected output of the test program, with Quadra 800 timing)
-
- - ------------------------------------------------------------------------------------------------
-
- --
- Dr. Michael P. McLaughlin (mpmcl@mitre.org)
- Center for Advanced Aviation System Development
- The MITRE Corporation, McLean VA, USA
-
- ---------------------------
-
- >From brinda@cvo.oneworld.com (John Brinda)
- Subject: Apple Event handlers & C++
- Date: Mon, 11 Mar 1996 01:07:38 -0800
- Organization: None
-
- Anyone have a simple way to add AE handlers to a small C++ application shell?
-
- I keep getting "illegal use of a non-static member" errors, and I don't
- want to make everything in my class static if I can help it...
-
- TIA
-
- -- John Brinda
- -- <A HREF="http://brinda.com/">Homepage</A>
- -- <A HREF="mailto:john@brinda.com">E-Mail</A>
- -- <A HREF="http://brinda.com/pgpkey.asc">PGP</A>
-
- +++++++++++++++++++++++++++
-
- >From brinda@cvo.oneworld.com (John Brinda)
- Date: Tue, 12 Mar 1996 08:49:46 -0800
- Organization: None
-
- In article <tulip-1103962042590001@tulip.tiac.net>, tulip@tiac.net (Ed
- Anson) wrote:
-
- >> Anyone have a simple way to add AE handlers to a small C++ application shell?
- >>
- >> I keep getting "illegal use of a non-static member" errors, and I don't
- >> want to make everything in my class static if I can help it...
- >
- >Only the AE handlers need to be static.
-
- First, thanks to the two people who replied. As always there are two ways
- to accomplish this -- an easy way and a more elegant way.
-
- The easy way is to create a static data member that points to the current
- application (App::App() {fCurrentApplication = this;}) and use that
- information to call the object methods from within the static handler. The
- more elegant way is to put this information in the AE user data.
-
- I chose the easy way for now. Maybe after reading Dave Mark's Ultimate Mac
- Programming I'll know enough about apple events to do it the other way.
- Somebody really needs to write a good C++ book for the Mac. The only one
- I've found is "Elements of C++ Macintosh Programming," which is good, but
- predates System 7.
-
- -- John Brinda
- -- <A HREF="http://brinda.com/">Homepage</A>
- -- <A HREF="mailto:john@brinda.com">E-Mail</A>
- -- <A HREF="http://brinda.com/pgpkey.asc">PGP</A>
-
- ---------------------------
-
- >From mars@netcom.com (Darren Giles)
- Subject: CodeWarrior - faster code than MrC?
- Date: Fri, 8 Mar 1996 11:37:40 GMT
- Organization: Terran Interactive
-
- SUMMARY:
- MrC seems to produce slower code than CodeWarrior! (At least, in my case)
-
- THE BACKGROUND:
- I'm trying to squeeze that last erg of performance out of some algorithms
- I'm working on. There are several routines that need to be optimized.
- Each is about 20-50 lines long, mainly nested loops... no function
- calls... *simple* pointer, integer, & float arithmatic. I've done about
- everything I can think of to the C code, and I want to avoid assembly.
- The only thing left seems to be the compiler.
-
- THE ENVIRONMENT:
- I'm using CodeWarrior as my main development environment, and I keep
- hearing how MrC and the Motorola compilers produce tighter code. So I
- tried compiling one of my routines with MPW/MrC, exporting it as a
- library, and linking with the rest of the project in CodeWarrior.
-
- THE RESULTS:
- MrC seemed to produce much *slower* code in this case:
- CodeWarrior v.8 : 175 mSec
- MPW/MrC 1.0 : 287 mSec
- MPW/MrC 2.0d1 : 208 mSec
- And yes, I am using the -opt speed flag.
-
- THE QUESTIONS:
- Should I be thrilled that CodeWarrior seems better than it gets credit for?
- Should I be disappointed that MrC didn't provide the edge I hoped for?
- Is there anything special I need to do to take advantage of MrC?
- Is there any way I can get ahold of a evaluation version of the Motorola
- compiler so I don't spend hundreds of $$$ to run into this again?
- Any other ideas?
-
- - Darren
-
- ==========================================================================
- Darren Giles, Technical Director Terran Interactive
- For info on Cleaner QuickTime compression, visit http://www.Terran-Int.com
-
- +++++++++++++++++++++++++++
-
- >From checker@netcom.com (Chris Hecker)
- Date: Sat, 9 Mar 1996 21:05:04 GMT
- Organization: NETCOM On-line Communication Services (408 261-4700 guest)
-
- mars@netcom.com (Darren Giles) writes:
- >Should I be thrilled that CodeWarrior seems better than it gets credit for?
- >Should I be disappointed that MrC didn't provide the edge I hoped for?
-
- You should be disappointed because all of the Mac PowerPC compilers are
- disappointing in my opinion. My next article in Game Developer
- Magazine (Jun/Jul, I think) is a Mac compiler review of sorts (CW8,
- SC8, MrC, and Motorola), and the conclusion I came to (at least for
- floating point code) is that you need to hold your compiler's hand if
- you care at all about the generated code.
-
- > Any other ideas?
-
- The differences between compilers was far less than the difference
- between hand optimized C and naive C, so your best bet is to look at
- the generated code on whatever compiler you're using and figure out
- what stupid stuff the compiler is doing. Then, try to figure out how
- you can write your source to give the compiler a clue.
-
- Chris
-
-
- +++++++++++++++++++++++++++
-
- >From checker@netcom.com (Chris Hecker)
- Date: Tue, 12 Mar 1996 06:41:17 GMT
- Organization: NETCOM On-line Communication Services (408 261-4700 guest)
-
- checker@netcom.com (Chris Hecker) writes:
- >disappointing in my opinion. My next article in Game Developer
- >Magazine (Jun/Jul, I think) is a Mac compiler review of sorts (CW8,
- >SC8, MrC, and Motorola),
-
- I forgot, I also covered the Microsoft VC++ cross compiler.
-
- Chris
-
- ---------------------------
-
- >From at@neuro.psy.soton.ac.uk (Adriaan Tijsseling)
- Subject: Desktop pattern for a window
- Date: Mon, 11 Mar 1996 09:34:41 +0000
- Organization: Electronics and Computer Science, University of Southampton
-
- Hi,
-
- I am using pixelpatterns as a background for a window and I want to use
- the pixelpattern that is used for the desktop. How can I access the
- desktop pattern. Which trap do I need to use?
-
- Many thanks in advance,
-
- Adriaan Tijsseling
-
- +++++++++++++++++++++++++++
-
- >From bore01@mail.macs.mankato.mn.us (Patrick Bores)
- Date: Mon, 11 Mar 1996 17:51:32 -0600
- Organization: Flatline Software
-
- In article <at-1103960934410001@sm1.psy.soton.ac.uk>,
- at@neuro.psy.soton.ac.uk (Adriaan Tijsseling) wrote:
-
- > Hi,
- >
- > I am using pixelpatterns as a background for a window and I want to use
- > the pixelpattern that is used for the desktop. How can I access the
- > desktop pattern. Which trap do I need to use?
- >
- > Many thanks in advance,
- >
- > Adriaan Tijsseling
-
- That's an easy one. The desktop pattern is ID 16 in the System file.
-
- FillWindowWithDeskPattern(WindowPtr TheWindow){
- PixPatHandle DeskPat;
-
- DeskPat = GetPixPat(16);
- FillCRect(&TheWindow->portRect,DeskPat);
- }
-
- That should do it.
- Patrick
-
- +++++++++++++++++++++++++++
-
- >From jakeg@voyager.co.nz (Jake Grover)
- Date: Tue, 12 Mar 1996 22:33:48 +1200
- Organization: OzEmail Pty Ltd - Australia
-
- > I am using pixelpatterns as a background for a window and I want to use
- > the pixelpattern that is used for the desktop. How can I access the
- > desktop pattern. Which trap do I need to use?
-
- OK.. I know this is different, but perhaps two birds could be killed here
- with the same stone. How do you get the utility pattern in System 7.5?
-
-
- Jake
-
- +++++++++++++++++++++++++++
-
- >From at@neuro.psy.soton.ac.uk (Adriaan Tijsseling)
- Date: Wed, 13 Mar 1996 20:38:50 +0000
- Organization: Electronics and Computer Science, University of Southampton
-
- In article <jakeg-1203962233480001@ts1p34.net.auckland.voyager.co.nz>,
- jakeg@voyager.co.nz (Jake Grover) wrote:
-
- > > I am using pixelpatterns as a background for a window and I want to use
- > > the pixelpattern that is used for the desktop. How can I access the
- > > desktop pattern. Which trap do I need to use?
- >
- > OK.. I know this is different, but perhaps two birds could be killed here
- > with the same stone. How do you get the utility pattern in System 7.5?
- >
-
-
- I got several replies on this. There is a routine called
- LMGetDeskCPat() which returns the pixpathandle of the desktop pattern. You
- can also retrieve this by calling GetPixPat(16). To get the Utilities
- pattern
- call this with the number 42 as argument.
-
- It works perfect!
-
- Adriaan Tijsseling
- ______________________________________________________________
-
- Work:
- Cognitive Sciences Centre
- Department of Psychology
- University of Southampton
- United Kingdom
-
- Homepages:
- work: http://www.soton.ac.uk/~coglab/coglab
- life: http://www.soton.ac.uk/~agt/
-
- E-mail:
- at@neuro.psy.soton.ac.uk
- at@cogsci.ecs.soton.ac.uk
- agt@oak.soton.ac.uk
- ______________________________________________________________
-
- ---------------------------
-
- >From elliott@mpi-muelheim.mpg.de (Mark Elliott)
- Subject: Direct-to-screen drawing and Copland
- Date: Thu, 14 Mar 1996 15:37:43 +0100
- Organization: Max-Planck-Institut f. Kohlenforsch. Muelheim
-
- Hi All,
-
- There has been a bit of debate about this, and I just got my latest
- developer mailing today, and here's the verdict.
-
- (not an exact quote, but the content of the quote is specific)
-
- 'Apple realises that some applications (specifically games are mentioned)
- NEED (my emphasis) direct-to-screen drawing. As long as you follow the
- guidelines set forth in the Develop article by Brigham Stevens (issue 11
- ?) then applications using this technique will still work under Copland
- (assuming you don't break any other rules, of course!)'.
-
- What this means is locking PixMaps. Getting base address using
- GetPixBaseAddr(), etc.
-
- I have not interpreted the text. It is all there in black and white. So
- one possible cause for game-programmers to worry about Copland is sorted.
-
- hope this reassures you.
-
- Mark
-
- - ------------------------------------------------------------------
- Mark C Elliott elliott@mpi-muelheim.mpg.de
- Max-Planck-Institut voice: (+49) 208 306 2429
- Fuer Kohlenforschung
- Muelheim, Germany
- - ------------------------------------------------------------------
-
- ---------------------------
-
- >From Romeo Chua <rchua@st.nepean.uws.edu.au>
- Subject: Shareware Modula-2 compiler for Mac
- Date: 11 Mar 1996 03:37:57 GMT
- Organization: UWS Nepean, Department Of Computing
-
- Can anybody tell me if there is a shareware Modula-2 compiler for the
- Mac?
-
- Regards
- Romeo Chua
-
-
- +++++++++++++++++++++++++++
-
- >From ldubois@syndetics.be (Luc Dubois)
- Date: Tue, 12 Mar 1996 10:21:30 +0100
- Organization: Syndetics Research
-
- In article <4i076l$40h@ob1.uws.EDU.AU>,
- Romeo Chua <rchua@st.nepean.uws.edu.au> wrote:
-
- > Can anybody tell me if there is a shareware Modula-2 compiler for the
- > Mac?
- >
- Romeo,
-
- There is MacMETH from the ETH in Switzerland, home of N. Wirth. The
- package can be found on the excellent Apprentice CD or online at
- <ftp://baikal.ethz.ch/pub/mac/RAMSES> (according to the readme file).
- Note that if you're looking for native PPC support you'll have to
- look elsewhere: the authors make it clear that they do not intend
- to add that. A lot of people at ETH consider Modula-2 a dead end now
- and are switching to Oberon-2 (Wirth's successor to Modula-2). There
- are 4 different Oberon compilers/environments for Macintosh on the
- cited cd. Oberon can be a bit confusing at first, since it is both the
- name of the language and an OS/development environment. And the latter
- isn't like anything else you (or your intended customer audience)
- might have seen before, or are willing to put up with, so be warned :-).
-
- You might also want to check out a very great www-page dedicated to
- Oberon which contains hundreds of references to (mainly) Oberon
- material but also has some references to Modula-2 compilers. The URL
- is <http://www.math.tau.ac.il/~laden/Ob-pkgs.html>.
-
- Good luck,
-
- Luc
- - ---------------------
- THEY may well be C-Borg.
- THEY may well think resistance is futile.
- *I* will damn well not be ass-C-milated.
-
-
-
-
-
- ---------------------------
-
- >From jeff@leland.Stanford.EDU (Jeffrey Matthew Bergan)
- Subject: Sharing Name
- Date: 27 Feb 1996 02:31:19 -0800
- Organization: Stanford University, CA 94305, USA
-
- Howdy,
-
- I'm trying to write a program that will change the name of the mac
- (The one that appears in the Sharing Setup control panel), but I can't
- seem to find how. I would be very greatfull if anyone could give me any
- advice on how to set this name. Thanks.
-
- Jeff Bergan
- jeff@leland.Stanford.EDU
-
- PS. I would also appreciate it if anyone who responds would send a copy to
- me through e-mail. Thanks a bunch.
-
- +++++++++++++++++++++++++++
-
- >From jumplong@aol.com (Jump Long)
- Date: 12 Mar 1996 01:57:06 -0500
- Organization: America Online, Inc. (1-800-827-6364)
-
- Jeffrey Matthew Bergan wrote:
- >I'm trying to write a program that will change the name of the
- >mac (The one that appears in the Sharing Setup control panel),
- >but I can't seem to find how. I would be very greatfull if
- >anyone could give me any advice on how to set this name.
- >Thanks.
-
- There's no API to do that and Apple specifically warns you not to do that.
- If you really have a need to let the user change the name of their system,
- then you should probably just send the Finder an AppleEvent to tell it to
- open the Sharing Setup control panel.
-
- - Jim Luther
-
- +++++++++++++++++++++++++++
-
- >From grinch@buffnet.net (The Grinch)
- Date: 13 Mar 1996 20:39:45 GMT
- Organization: Vortex Software
-
- In article <4i3782$a1q@newsbf02.news.aol.com>, jumplong@aol.com (Jump
- Long) wrote:
-
- > Jeffrey Matthew Bergan wrote:
- > >I'm trying to write a program that will change the name of the
- > >mac
-
- Call this with (-16413, 'My Mac'). It's not pretty, but it does work.
-
- -The Grinch B-)
-
- function setSysSTR (ID: integer; s: str255): str255;
- const
- strTipe = 'STR ';
- var
- funkyResFile: integer;
- resident: handle;
- myErr: OSErr;
- begin
- funkyResFile := curResFile;
- useResFile(0);
-
- resident:=get1Resource(strTipe, ID);
- if resident=nil then begin {create resource}
- resident:=newHandle(0);
- AddResource(resident, strTipe, ID, '');
- myErr:=resError;
- if myErr=noErr then {OK}
- writeResource(resident)
- else
- disposeHandle(resident);
- end
- else
- myErr:=noErr; {OK}
-
- if myErr=noErr then begin {resident is a valid res handle}
- setHandleSize(resident, length(s)+1);
- HLock(resident);
- BlockMove(@s, resident^, length(s)+1); {+length byte}
- HUnlock(resident);
- ChangedResource(resident);
- myErr:=resError;
- if myErr=noErr then begin
- writeResource(resident);
- myErr:=resError;
- end;
- releaseResource(resident);
- end; {resident exists}
- useResFile(funkyResFile);
- setSysSTR := strErr(myErr);
- end;
-
- +++++++++++++++++++++++++++
-
- >From grinch@buffnet.net (The Grinch)
- Date: 15 Mar 1996 21:31:50 GMT
- Organization: Vortex Software
-
- > > > >I'm trying to write a program that will change the name of the
- > > > >mac
- > >
- > > Call this with (-16413, 'My Mac'). It's not pretty, but it does work.
- > >
- > > -The Grinch B-)
- > >
- > > code to alter system file removed
- >
- > And right after this, you might as well force a reboot.
-
- Actually, I did. That was cut from a program that sets up computer labs.
-
- -The Grinch
-
- ---------------------------
-
- >From fred@lightside.net (Fred Condo)
- Subject: Writing a scriptable app
- Date: Sun, 03 Mar 1996 00:10:25 -0800
- Organization: Lightside, Inc. - Internet Access
-
- So... I've been off doing things besides writing Mac applications for a
- couple years, but now I have a need to write a small app or FBA that needs
- to be scriptable via AppleScript. I've read and understood the AppleEvent
- Manager chapter of IM-VI.
-
- What documentation should I read to get me jumpstarted on this task?
- Pointers to sample code would be great too. Thank you!
- --
- http://www.lightside.net/~fred/ + net access + http://www.lightside.net/
- "Attempts to control the use of encryption technology are wrong in
- principle, unworkable in practice, and damaging to the long term economic
- value of the information networks." - UK Labour Party
-
- +++++++++++++++++++++++++++
-
- >From jonpugh@netcom.com (Jon Pugh)
- Date: Sun, 10 Mar 1996 20:25:34 GMT
- Organization: Apple Computer
-
- In article <fred-0303960010260001@st-ursen.lightside.net>,
- fred@lightside.net (Fred Condo) wrote:
-
- >So... I've been off doing things besides writing Mac applications for a
- >couple years, but now I have a need to write a small app or FBA that needs
- >to be scriptable via AppleScript. I've read and understood the AppleEvent
- >Manager chapter of IM-VI.
- >
- >What documentation should I read to get me jumpstarted on this task?
- >Pointers to sample code would be great too. Thank you!
-
- The simplest solution is to use a framework, like TCL2, PowerPlant or
- MacApp 3.3. All of these have the majority of the work done for you. Any
- other course of action will require you to write your own AE framework.
-
- The net question is, how complex is your app? If it is ultra-simple, as
- most FBAs are, then you might be able to get away with just writing a set
- of handlers. The real question is about your content model. What data
- are you trying to expose? The complexity of this will determine how much
- framework you will need. The simpler your content model, the more likely
- you can just use a set of simple handlers. The more complex your model,
- the more likely you are to benefit from the framework route.
-
- Jon
-
- --
- What are YOU doing to oppose the Microsoft juggernaut?
- http://www.infoworkshop.com/~jonpugh/
-
- ---------------------------
-
- >From julian@cs.auckland.ac.nz (Julian Harris)
- Subject: [Q] How to write a FAT inline LDEF
- Date: Fri, 08 Mar 1996 10:54:36 +1300
- Organization: Computer Science, The University of Auckland
-
- Hi all,
-
- A common Mac programmer trick to get over the ugliness of LDEFs is to make
- them inline. You do this by calling LNew with a 0 LDEF ID so it reverts to
- the system LDEF then you allocate a handle that contains a JMP instruction
- to your actual LDEF in your code. It's way cool - it's easy to debug and
- develop with such a mechanism.
-
- However, in the world of PowerPC does anyone know how to do such a thing
- and make it PowerMac native? A friend suggested that the only change that
- will work is having my LDEF stub jump to a UPP, but this means a mixed
- mode switch for every call which is insanely ugly. But then I guess so is
- the original hack.
-
- Any comments?
-
- TIA!
- . . . . . . . . . . . . . . . . . . . . . . . . . . .
- > Julian Harris, Programmer >
- By doing just a little every day, > Comp. Sci. Dept. x8915 >
- you can gradually let the task > The University of Auckland >
- completely overwhelm you. > julian@cs.auckland.ac.nz >
-
- +++++++++++++++++++++++++++
-
- >From devon@apple.com (Devon Hubbard)
- Date: Thu, 14 Mar 1996 20:04:04 -0800
- Organization: Apple Computer
-
- In article <julian-0803961054360001@julian.cs.auckland.ac.nz>,
- julian@cs.auckland.ac.nz (Julian Harris) wrote:
-
- > A common Mac programmer trick to get over the ugliness of LDEFs is to make
- > them inline. You do this by calling LNew with a 0 LDEF ID so it reverts to
- > the system LDEF then you allocate a handle that contains a JMP instruction
- > to your actual LDEF in your code. It's way cool - it's easy to debug and
- > develop with such a mechanism.
-
- Actually, the steps involve using the same LDEF procID you would in your
- regular LNew call and setting up of the dummy LDEF handle BEFORE calling
- LNew.
-
- > However, in the world of PowerPC does anyone know how to do such a thing
- > and make it PowerMac native? A friend suggested that the only change that
- > will work is having my LDEF stub jump to a UPP, but this means a mixed
- > mode switch for every call which is insanely ugly. But then I guess so is
- > the original hack.
- > Any comments?
-
- I hate to nitpick further but there typically won't be such a thing as a
- 'FAT' inline LDEF. You application is going to either be 68k or PPC so
- the dummy LDEF stub is going to jump back to either but not both. Of
- course one could setup a LDEF stub to be FAT with ptrs to 68k and PPC code
- somewhere else beside the running app.
-
- I'm not sure if you needed the code, but here's one way to setup an LDEF
- so it jumps back into your PPC application making it (the LDEF) easier to
- debug.
-
- Hope this helps.
-
- dEVoN
-
- - --------
- The items to be defined here are:
-
- procID - the LDEF proc id you'll be using in LNew().
- LDEFMain - the name of the LDEF code's main entry point.
- (it won't be called main() when linked into your app)
-
- // For testing LDEF code inline with a project
- // This code modifies the 'LDEF' rsrc in RAM to jump back into a
- // statically linked LDEF routine built into the app so it can be
- // easily debugged.
- ProcInfoType kLDEFprocInfo = kPascalStackBased
- | STACK_ROUTINE_PARAMETER(1, kTwoByteCode)
- | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean)) )
- | STACK_ROUTINE_PARAMETER(3, kFourByteCode)
- | STACK_ROUTINE_PARAMETER(4, kFourByteCode)
- | STACK_ROUTINE_PARAMETER(5, kTwoByteCode)
- | STACK_ROUTINE_PARAMETER(6, kTwoByteCode)
- | STACK_ROUTINE_PARAMETER(7, kFourByteCode);
-
- Handle theLDEFH = GetResource('LDEF', procID);
- if (theLDEFH)
- {
- #ifdef powerc
- UniversalProcPtr procUPP = NewRoutineDescriptor((ProcPtr)LDEFMain,
- kLDEFprocInfo ,GetCurrentISA());
- if (procUPP)
- {
- long procSize = GetPtrSize((Ptr)procUPP);
- SetHandleSize( theLDEFH, procSize);
- if (!MemError())
- BlockMove( procUPP, (*theLDEFH), procSize);
-
- HNoPurge(theLDEFH);
- }
- #else
- • Sorry, NO 68K LDEF stub code yet! (intentional compile err)
- #endif
- }
-
- ... go on to call LNew with the same 'procID'
- - ---------
-
- ---------------------------
-
- >From support@fluxsoft.com (Maurice Volaski)
- Subject: [Q] Where is the NBP queue located on an Open Transport-based Mac?
- Date: Wed, 06 Mar 1996 02:27:25 -0500
- Organization: Flux Software
-
- I have some code that is trying to obtain a pointer to the table of
- registered NBP entities on a Mac. Here is the snippet:
-
- MPPParamBlock anMPP;
- NamesTableEntry *theNamesTable;
-
- if(PGetAppleTalkInfo(&anMPP,false)==0)
- // find the registered names table.
- {
- theNamesTable=(NamesTableEntry *)anMPP.GAIINFO.nTQueue;
- }
-
- The above code works fine on standard Appletalk-based Macs, but on an Open
- Transport (1.0.8)-based 8500, theNamesTable is zero. Does anyone know why
- this is happening?
-
- --
- Maurice Volaski, Flux Software support@fluxsoft.com
- http://www.fluxsoft.com/ ftp://ftp.fluxsoft.com
-
- +++++++++++++++++++++++++++
-
- >From jumplong@aol.com (Jump Long)
- Date: 9 Mar 1996 04:47:55 -0500
- Organization: America Online, Inc. (1-800-827-6364)
-
- >I have some code that is trying to obtain a pointer to the table
- >of registered NBP entities on a Mac. Here is the snippet:
- >
- >MPPParamBlock anMPP; NamesTableEntry *theNamesTable;
- >
- >if(PGetAppleTalkInfo(&anMPP,false)==0)
- > // find the registered
- >names table. {
- > theNamesTable=(NamesTableEntry *)anMPP.GAIINFO.nTQueue; }
- >
- >The above code works fine on standard Appletalk-based Macs, but
- >on an Open Transport (1.0.8)-based 8500, theNamesTable is zero.
- >Does anyone know why this is happening?
-
- My guess is that they don't want you mucking with the names table
- directly.
-
- Using the names table directly was never very safe unless you disabled
- interrupts completely while walking the linked list. That's because
- PRemoveName can be called at interrupt time and that makes it possible for
- your code crash if the names table entry you're looking at or about to
- look (if you already have its address) at gets unlinked from the list adn
- the memory gets reused.
-
- If you want the list of names on your system, you can turn on self-send
- mode with PSetSelfSend, do a PLookupName using the entity name "=", the
- entity type "=", and the zone "*" (the local zone), and then filter out
- all matches that don't have your system's node and net address (get that
- with GetNodeAddress).
-
- - Jim Luther
-
- ---------------------------
-
- >From zzkbergm@dingo.uq.edu.au (Christoph Bergmann)
- Subject: gworlds 7.5.3
- Date: Tue, 12 Mar 1996 19:05:53 +1000
- Organization: University of Queensland
-
-
- heres an interesting one.. dunno whos fault it is, dont care, just wanted
- to point it out..
-
- NewGWorld with a bitdepth of 24 on my powermac 7100/80 w 16bit 14"
- monitor, returns a param error...
- (err-157 invalid pixel depth)
- pre 7.5.3 it worked fine..
-
- just in case anyone wanted to know :)
-
- chris
-
- +++++++++++++++++++++++++++
-
- >From pottier@jonque.ens.fr (Francois Pottier)
- Date: 13 Mar 1996 16:44:35 GMT
- Organization: Ecole Normale Superieure, Paris
-
- In article <zzkbergm-1203961905530001@zzkbergm.slip.cc.uq.oz.au>,
- Christoph Bergmann <zzkbergm@dingo.uq.edu.au> wrote:
-
- >pre 7.5.3 it worked fine..
-
- Well, they have fixed a bug :-) 24 was not a valid bit depth.
- Of course it might be annoying to some people...
-
- --
- Francois Pottier
- Francois.Pottier@ens.fr
- Francois.Pottier@inria.fr
- http://www.eleves.ens.fr:8080/home/pottier/
-
- +++++++++++++++++++++++++++
-
- >From bwade@qualia.com (Bretton Wade)
- Date: Tue, 12 Mar 1996 10:38:37 -0500
- Organization: qualia, inc.
-
- pixel depth should be set to 32...
-
- In article <zzkbergm-1203961905530001@zzkbergm.slip.cc.uq.oz.au>,
- zzkbergm@dingo.uq.edu.au (Christoph Bergmann) wrote:
-
- # heres an interesting one.. dunno whos fault it is, dont care, just wanted
- # to point it out..
- #
- # NewGWorld with a bitdepth of 24 on my powermac 7100/80 w 16bit 14"
- # monitor, returns a param error...
- # (err-157 invalid pixel depth)
- # pre 7.5.3 it worked fine..
- #
- # just in case anyone wanted to know :)
- #
- # chris
-
- --
- bwade@qualia.com
- http://www.qualia.com/
-
-
- ---------------------------
-
- End of C.S.M.P. Digest
- **********************
-